/*
@author https://yunp.top
 */
@file:JsQualifier("createjs")

package createjs

import js.Array
import org.w3c.dom.CanvasRenderingContext2D
import org.w3c.dom.HTMLCanvasElement

open external class DisplayObject : EventDispatcher {

    companion object {
        var suppressCrossDomainErrors: Boolean
    }

    var alpha: Double
    val bitmapCache: BitmapCache
    val cacheCanvas: HTMLCanvasElement
    var compositeOperation: String
    var cursor: String
    var filters: Array<Filter>
    var hitArea: DisplayObject
    var id: Int
    var mask: Shape
    var mouseEnabled: Boolean
    var name: String
    val parent: Container
    var regX: Double
    var regY: Double
    var rotation: Double
    var scale: Double
    var scaleX: Double
    var scaleY: Double
    var shadow: Shadow
    var skewX: Double
    var skewY: Double
    var snapToPixel: Boolean
    val stage: Stage
    var tickEnabled: Boolean
    var transformMatrix: Matrix2D
    var visible: Boolean
    var x: Double
    var y: Double

    fun cache(
        x: Int,
        y: Int,
        width: Int,
        height: Int,
        scale: Double = definedExternally,
        options: dynamic = definedExternally
    )

    fun clone(): DisplayObject
    fun draw(ctx: CanvasRenderingContext2D, ignoreCache: Boolean = definedExternally): Boolean
    fun getBounds(): Rectangle
    fun getCacheDataURL(): String
    fun getConcatenatedDisplayProps(props: DisplayProps = definedExternally): DisplayProps
    fun getConcatenatedMatrix(matrix: Matrix2D = definedExternally): Matrix2D
    fun getMatrix(matrix: Matrix2D = definedExternally): Matrix2D
    fun getTransformedBounds(): Rectangle

    // TODO https://createjs.com/docs/easeljs/classes/DisplayObject.html
}